public class middle_of_the_linked_list {
    public ListNode middleNode(ListNode head) {
        if(head==null) return  head;
        ListNode fast=head;
        ListNode slow=head;
        while(fast!=null&&fast.next!=null){
            slow=slow.next;
            fast=fast.next.next;
        }
        return slow;
    }
}
